package vn.vfriends.id.util;

import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;

/**
 *
 * @author tuan@vfriends.vn
 */
public class Constants {

    public static String BASIC_URL = "";
    public static final String WS_USERNAME = "USERNAME";
    public static final String WS_PASSWORD = "PASSWORD";
    
    static {
        synchronized (BASIC_URL) {
            if (BASIC_URL.length() == 0) {
                FacesContext context = FacesContext.getCurrentInstance();
                HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
                BASIC_URL += request.getRequestURL().substring(0, request.getRequestURL().length() - request.getRequestURI().length()).toString();
                BASIC_URL += request.getContextPath();
            }
        }
    }
}
